<template>
  <div>
    <XuanGou
      v-for="(item, index) in list"
      :key="index"
      :img="item.dogImgUrl"
      :name="item.dogName"
      :index="index"
      @xiaogou="babala"
    >
    </XuanGou>
    <p>显示喜欢的狗：</p>
    <p v-for="(item, index) in arr" :key="index">{{ item }}</p>
  </div>
</template>

<script>
import XuanGou from './components/XuanGou.vue'

export default {
  methods: {
    babala(i) {
      this.arr.push(this.list[i].dogName)
      console.log(this.arr)

      
    },
  },
  data() {
    return {
      arr: [],
      list: [
        {
          dogImgUrl:
            'http://nwzimg.wezhan.cn/contents/sitefiles2029/10146688/images/21129958.jpg',
          dogName: '博美',
        },
        {
          dogImgUrl:
            'https://img2.baidu.com/it/u=2582437364,3079521481&fm=253&fmt=auto&app=120&f=JPEG?w=700&h=497',
          dogName: '泰迪',
        },
        {
          dogImgUrl:
            'https://img2.baidu.com/it/u=2701916651,489308068&fm=253&fmt=auto&app=138&f=JPEG?w=433&h=650',
          dogName: '金毛',
        },
        {
          dogImgUrl:
            'https://pic1.zhimg.com/80/v2-7ba4342e6fedb9c5f3726eb0888867da_1440w.jpg?source=1940ef5c',
          dogName: '哈士奇',
        },
        {
          dogImgUrl:
            'https://img2.baidu.com/it/u=3034105176,2359832232&fm=253&fmt=auto&app=138&f=JPEG?w=446&h=500',
          dogName: '阿拉斯加',
        },
        {
          dogImgUrl:
            'https://img0.baidu.com/it/u=3781103233,1164839424&fm=253&fmt=auto&app=138&f=JPEG?w=648&h=500',
          dogName: '萨摩耶',
        },
      ],
    }
  },
  components: {
    XuanGou,
  },
}
</script>

<style></style>
